﻿namespace GoodAdmin.System;

public interface IFileService
{
    /// <summary>
    /// 分页查询文件
    /// </summary>
    /// <returns></returns>
    Task<dynamic> Page(FilePageInput input);
    /// <summary>
    /// 删除文件
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task Delete(BaseIdInput input);
    /// <summary>
    /// 上传文件
    /// </summary>
    /// <returns></returns>
    Task<SysFile> UploadFile(IFormFile file, string type);

    /// <summary>
    /// 上传文件并保存信息到数据库
    /// </summary>
    /// <param name="file"></param>
    /// <param name="type"></param>
    /// <returns></returns>
    Task UploadFileAndSaveDb(IFormFile file, string type);

    /// <summary>
    /// 批量上传文件并保存信息到数据库
    /// </summary>
    /// <param name="files"></param>
    /// <param name="type"></param>
    /// <returns></returns>
    Task BatchUploadFileAndSaveDb(IList<IFormFile> files, string type);

    /// <summary>
    /// 根据数据库Id下载文件
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task<IActionResult> Download(BaseIdInput input);

    /// <summary>
    /// 根据路径下载文件
    /// </summary>
    /// <param name="path"></param>
    /// <param name="name"></param>
    /// <returns></returns>
    Task<IActionResult> Download(string path,string name);

    /// <summary>
    /// 生成文件存储路径
    /// </summary>
    /// <returns></returns>
    Task<(string saveEngine, string EnginePath,string RelativeDirPath)> CreateFilePath(string type);
}
